package org.lt.cj.view.swing;

/**
 *
 * @author zgh
 */
public class BrandListDialog extends javax.swing.JDialog {

    /** Creates new form BrandListDialog */
    public BrandListDialog(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        setTypeColumnWidth();
        setLocationRelativeTo(null);
    }

    private void setTypeColumnWidth() {
        jProductTypeTable.setRowHeight(25); //
        //
        jProductTypeTable.getColumnModel().getColumn(0).setMinWidth(40);
        jProductTypeTable.getColumnModel().getColumn(0).setPreferredWidth(50);
        jProductTypeTable.getColumnModel().getColumn(0).setMaxWidth(60);

        jProductTypeTable.getColumnModel().getColumn(1).setMinWidth(80);
        jProductTypeTable.getColumnModel().getColumn(1).setPreferredWidth(100);
        jProductTypeTable.getColumnModel().getColumn(1).setMaxWidth(120);

        jProductTypeTable.getColumnModel().getColumn(2).setMinWidth(80);
        jProductTypeTable.getColumnModel().getColumn(2).setPreferredWidth(120);
        jProductTypeTable.getColumnModel().getColumn(2).setMaxWidth(200);

        jProductTypeTable.getColumnModel().getColumn(3).setMinWidth(60);
        jProductTypeTable.getColumnModel().getColumn(3).setPreferredWidth(100);
        jProductTypeTable.getColumnModel().getColumn(3).setMaxWidth(160);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jCancelButton = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jProductTypeTable = new javax.swing.JTable();
        jDeleteButton = new javax.swing.JButton();
        jEditButton = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("");
        setResizable(false);

        jCancelButton.setText("");
        jCancelButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCancelButtonActionPerformed(evt);
            }
        });

        jProductTypeTable.setModel(model);
        jProductTypeTable.getTableHeader().setReorderingAllowed(false);
        jScrollPane1.setViewportView(jProductTypeTable);

        jDeleteButton.setText("");
        jDeleteButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jDeleteButtonActionPerformed(evt);
            }
        });

        jEditButton.setText("");
        jEditButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jEditButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(69, 69, 69)
                        .addComponent(jEditButton, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(68, 68, 68)
                        .addComponent(jDeleteButton, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(72, 72, 72)
                        .addComponent(jCancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 521, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jCancelButton)
                    .addComponent(jEditButton)
                    .addComponent(jDeleteButton))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 412, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jCancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCancelButtonActionPerformed
        this.dispose();
    }//GEN-LAST:event_jCancelButtonActionPerformed

    private void jEditButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jEditButtonActionPerformed
    }//GEN-LAST:event_jEditButtonActionPerformed

    private void jDeleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jDeleteButtonActionPerformed
    }//GEN-LAST:event_jDeleteButtonActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                BrandListDialog dialog = new BrandListDialog(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {

                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jCancelButton;
    private javax.swing.JButton jDeleteButton;
    private javax.swing.JButton jEditButton;
    private javax.swing.JTable jProductTypeTable;
    private javax.swing.JScrollPane jScrollPane1;
    // End of variables declaration//GEN-END:variables
    private BrandListTableModel model = new BrandListTableModel();
}
